from django import template
from ..forms import StopForm


register = template.Library()


@register.inclusion_tag('advisor/inclusions/_form.html', takes_context=True)
def show_stops_form(context, city, new_form, start_error=None, end_error=None, form=None):
    if form is None or new_form:
        form = StopForm()
    return {
        'form': form,
        'city': city,
        'start_error': start_error,
        'end_error': end_error,
    }
